<div id="preview" style="display:none">{if isset($errors.status) && $errors.status == "preview"}{$previewUrl}{/if}</div>
<form name="FormNews" method="post" action="{$modal.href}" class="nyroModal">
{t assignTo=headerTitle}Add / Edit an article{/t}
{include file="$MODULES_DIR/backoffice/templates/block/modal/ModalTitle.html" title=$headerTitle}
    <div id="modalContent" style="width: 720px; height: 600px;">
        <div id="modalTabs">
        <ul>
            <li><a href="#" {if isset($formValues.selectedTab) && $formValues.selectedTab == 'tab1' || !isset($formValues.selectedTab)}class="selected"{/if} title="{t}Properties{/t}" rel="tab1"><span>{t}Properties{/t}{if isset($errors.label) || isset($errors.publicationStart) || isset($errors.url)} {icon name="warning.png" size="12"}{/if}</span></a></li>
            <li><a href="#" {if isset($formValues.selectedTab) && $formValues.selectedTab == 'tab2'}class="selected"{/if} title="{t}Content{/t}" rel="tab2"><span>{t}Content{/t}{if isset($errors.intro) || isset($errors.content)} {icon name="warning.png" size="12"}{/if}</span></a></li>
            <li><a href="#" {if isset($formValues.selectedTab) && $formValues.selectedTab == 'tab3'}class="selected"{/if} title="{t}Links{/t}" rel="tab3"><span>{t}Links{/t}</span></a></li>
        </ul>
        </div>
        <div id="tab1" class="modalTab">
        <table class="listTable">
          <tr>
            <td>{t}Publication status{/t}</td>
            <td>
                <select name="FormNews[status]" id="statusSelectBox" title="{t}Publication status - Define if the news is published or not.{/t}">
                    <option value="DRAFT" {if isset($formValues.status) && $formValues.status == "DRAFT"}selected="selected"{/if}">{t}Unpublished{/t}</option>
                    <option value="PUBLISHED" {if isset($formValues.status) && $formValues.status == "PUBLISHED"}selected="selected"{/if}>{t}Published{/t}</option>
                </select>
            </td>
          </tr>
          <tr>
            <td><label for="form_label_label">{t}Title{/t} *</label></td>
            <td>
                <input type="text" id="form_label_label" name="FormNews[label]" value="{if isset($formValues.label)}{$formValues.label|escape:"html"}{/if}" style="width:550px" />
                {if isset($errors.label)}<br /><span>{icon name="warning.png"}{$errors.label}</span>{/if}
            </td>
          </tr>
          <tr>
            <td><label for="form_label_eventDates">{t}Subtitle{/t}</label></td>
            <td>
                <input type="text" id="form_label_eventDates" title="{t}Subtitle - For an event, you can for example type the dates.{/t}" name="FormNews[eventDates]" value="{if isset($formValues.eventDates)}{$formValues.eventDates|escape:"html"}{/if}" style="width:550px" />
                {if isset($errors.eventDates)}<span>{icon name="warning.png"}{$errors.eventDates}</span>{/if}
            </td>
          </tr>
          <tr>
            <td><label for="form_label_label">{t}URL{/t}</label></td>
            <td>
                <input type="text" id="form_label_url" name="FormNews[url]" value="{if isset($sendUrl) && $sendUrl != ""}{$sendUrl}{else}{if isset($formValues.url)}{$formValues.url|escape:"html"}{/if}{/if}" style="width:550px" />
                {if isset($errors.url) && $errors.url != "copy"}<br /><span>{icon name="warning.png"}{$errors.url}</span>{/if}
            </td>
          </tr>
          <tr>
            <td>{t}Publication dates{/t}</td>
            <td>
                <label for="form_label_publicationStart">{t}Start{/t} </label>
                <input type="text" id="form_label_publicationStart" title="{t}Start date - Keep it empty if the news don't have start publication date, the news will be published until the end date is passed.{/t}" name="FormNews[publicationStart]" value="{if isset($formValues.publicationStart) && $formValues.publicationStart!=''}{date date=$formValues.publicationStart smartformat="localized-data-format"}{/if}" style="width:100px" class="dateInput" />
                {if isset($errors.publicationStart)}<span>{icon name="warning.png"}{$errors.publicationStart}</span>{/if} 
                <label for="form_label_publicationEnd">{t}End{/t} </label>
                <input type="text" id="form_label_publicationEnd" title="{t}End date - Keep it empty if the news don't have end publication date, the news will be published once the start date is passed.{/t}" name="FormNews[publicationEnd]" value="{if isset($formValues.publicationEnd) && $formValues.publicationEnd!=''}{date date=$formValues.publicationEnd smartformat="localized-data-format" isNull=true}{/if}" style="width:100px" class="dateInput" />
                {if isset($errors.publicationEnd)}<span>{icon name="warning.png"}{$errors.publicationEnd}</span>{/if}
            </td>
          </tr>
          <tr>
              <td><label for="form_label_intro">{t}Header{/t}</label></td>
            <td>                
                <textarea id="form_label_intro" style="width: 550px;height: 140px;" name="FormNews[intro]" >{if isset($formValues.intro)}{$formValues.intro|escape:"html"}{/if}</textarea>
                {if isset($errors.intro)}<span>{icon name="warning.png"}{$errors.intro}</span>{/if}
            </td>
          </tr>
        </table>
        </div>
        <div id="tab2" style="display:none" class="modalTab">
        <table class="listTable">
          <tr>              
            <td colspan="2">
                <input type="hidden" value="{$URL_RELATIVE}/themes/{$FRONT_THEME}/frontend/css/tinyMCE.css" id="MCEtheme" />
                <input type="hidden" value="{$blockParams.pageLang}" id="MCElang" />
                <input type="hidden" value="pz-block pz-block-newsDetail" id="MCEclass" />
                <textarea id="form_label_content" rows="20" cols="80" style="width:100%;height: 380px;" class="mceEditor" name="FormNews[content]"  >{if isset($formValues.content)}{$formValues.content|escape:"html"}{/if}</textarea>
                {if isset($errors.content)}<span>{icon name="warning.png"}{$errors.content}</span>{/if}
            </td>
          </tr>
        </table>
        </div>
        <div id="tab3" class="modalTab" style="display:none">
        <table class="listTable">
            <tr>
                <td style="width: 100px;"><label for="form_label_picture">{t}Picture{/t}</label></td>
                <td>
                    {block module=backoffice action=GenericPictureSelect docId=$formValues.picture formName="FormNews[picture]"}
                </td>
            </tr>
        </table>
        <input type="hidden" name="FormNews[preview]" value="false" id="isPreview" />
        <input type="hidden" name="FormNews[selectedTab]" value="tab1" id="selectedTab" />
        </div>
    </div>
    {setTplParams localesModule="backoffice"}
    </div></td><td id="modalRightShadow">&nbsp;</td></tr></table>
    <div id="modalFooter">
        <table width="100%">
            <tr>
                <td id="modalBarLeft">&nbsp;</td>
                <td id="modalBarMid">
                    <div>
                        <button type="button" class="nyroModalClose bigGreyButton" >{t}Cancel{/t}</button>
                        {if $canPreview}<input type="submit" class="bigGreyButton" onclick="$('#selectedTab').val($('#modalTabs a.selected').attr('rel'));$('#isPreview').val('true');{if isset($onClickParam)}{$onClickParam}{else}tinyMCE.triggerSave();{/if}" value="{t}Preview{/t}" />{/if}
                        <input type="submit" class="bigGreenButton" onclick="{if isset($onClickParam)}{$onClickParam}{else}tinyMCE.triggerSave();{/if}" value="{t}Save{/t}" />
                    </div>
                </td>
                <td id="modalBarRight">&nbsp;</td>
            </tr>
        </table>
    </div>
    {/setTplParams}
</form>